<template>
	<view>
		<nav-header bgColor="bg-custom-color" :isBack="true">
			<block slot="backText">{{$t('back')}}</block>
			<block slot="content">{{$t('team.title')}}</block>
		</nav-header>
		
		<view class="top bg-cyan">
			<view class="top-img-view">
				<view class="cu-avatar xl round" style="float: left;" :style="'background-image:url('+user_logo+');background-color: #121e2e;'"></view>
				<view class="userInfo">
					<view class="user-name">{{userInfo.realName}}</view>
					<view class="user-name" style="padding-top: 0px;">{{userInfo.mobile}}</view>
				</view>
				<view class="team-div">
					<view class="team-item"><view>{{$t('team.team')}}</view><view>{{list.length}}</view></view>
					<view class="team-item"><view>{{$t('team.effectiveMember')}}</view><view>{{leijiMoneyUserList.length}}</view></view>
					<view class="team-item"><view>{{$t('team.TeamPerformance')}}</view><view>{{leijiMoneySum}}</view></view>
				</view>
			</view>
		</view>
		<view class="cu-bar bg-custom-color solid-bottom boder_bottom hy">
			<view class="action">
				<text class="cuIcon-titles text-orange"></text> {{$t('team.title')}}
			</view>
		</view>
		<view class="lc-2 bg-custom-color">
			<view class="cl-2-nav text-color">
				<text class="cl-2-nav-title">{{$t('team.name')}}</text>
				<text class="cl-2-nav-title">{{$t('team.usdtBalance')}}</text>
				<text class="cl-2-nav-title">{{$t('team.registerTime')}}</text>
			</view>
			<view class="cl-2-nav" v-for="(item,index) in list">
				<text class="cl-2-nav-title content">{{item.userName}}</text>
				<text class="cl-2-nav-title content">{{item.biDianzi}}</text>
				<text class="cl-2-nav-title content">{{$common.dateFormat(item.addDate)}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	var t
	export default {
		data() {
			return {
				userInfo: {},
				user_logo: '/static/logo.png',
				list:[],
				leijiMoneyUserList:[],
				leijiMoneySum:0
			};
		},
		onLoad() {
			t = this;
			this.$i18n.locale = t.$common.localRead("local")
			t.userInfo = $common.getUser()
			if(!t.userInfo){
				$common.notLoginUser()
			}
			console.info(t.userInfo)
			this.getData();
		},
		methods: {
			getData: function() {
				let data = {
					userId:t.userInfo.id
				}
				t.$fetch.request('userInfo/appTeamList',data).then((res) => {
					console.info(res)
					if (res.code == 200) {
						t.list = res.data.entityList
						t.leijiMoneyUserList =res.data.leijiMoneyUserList
						t.leijiMoneySum = res.data.leijiMoneySum
					} else {
						$common.showToast(res.msg);
					}
				}).catch((e) => {})
			},
		}

	}
</script>

<style>
	.content{
		color: darkgray;
	}
	.cl-2-nav{
		display: flex;
		padding: 10px;
	}
	.cl-2-nav-title{
		flex: 1;
		text-align: center;
	}
	.top {
		height: 300upx;
	}
	.userInfo{
		    float: left;
		    margin-left: 20px;
		    text-align: left;
	}

	.top-img-view {
		text-align: center;
		padding: 20px;
	}

	.user-name {
		padding: 20upx 0;
		color: white;
	}

	.content {
		height: 100%;
	}

	.nav .cu-item {
		padding: inherit;
		height: 120upx;
		line-height: 120upx;
		position: relative;
	}

	.cu-tag.badge {
		top: 6upx;
		right: -6upx;
	}

	.back {
		position: fixed;
		width: 100%;
		bottom: 10px;
	}
	.team-div{
		    clear: both;
		    display: flex;
			margin-top: 180upx;
	}
	.team-item{
		flex: 1;
	}
	
	.text-grey {
		color: #E3E8FB;
	}
	
	.cu-list.menu>.cu-item {
		background-color: #121E2E;
	}
	.bg-cyan {
	    background-color: #121e2e;
	    color: #E3E8FB;
	}
</style>
